<script>
import apiEmp from "@/pages/v1/mes/Emp/js/apiEmp";
import apiPlan from "@/pages/v1/mes/Plan/js/apiPlan";
import apiFlow from "@/pages/v1/mes/Flow/js/apiFlow";

export default {
  name: 'QrCodeHolder',
  props: {
    value:"",
    title:"",
  },
  data() {
    return {
      inSideValue:"200240716.21.192"
    }
  },
  mounted() {
  },
  methods:{
    handle(){
      this.$emit("input",null,this.inSideValue)

      // this.getPlan()
      // this.getFlow()
    },


    getPlan(){
      let pi = this.getPlanInfoFromCode(this.inSideValue)
      apiPlan.findBy({_where:{sn:pi.plan},_dumps:["template.processes"]},res=>{
        if (res.length > 0){
          this.$emit("input",res[0],this.inSideValue)
        }
      })
      // this.inSideValue = ""
    },
    getPlanInfoFromCode(code){
      let arr = code.split(".")
      return {
        plan:arr[0],
      }
    },
    // getFlow(){
    //   apiFlow.findBy({_where:{sn:this.inSideValue}},res=>{
    //     console.log(res)
    //   })
    // }
  }
}
</script>

<template>
  <div class="flrc">
    <mu-text-field @keydown.enter="handle" v-model="inSideValue" :label="title" label-float action-icon="qr_code"></mu-text-field>
    <div class="flex1 padl10"><mu-button flat @click="handle">刷新</mu-button></div>
  </div>
</template>

<style scoped>

</style>